<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../static/jquery-easyui-1.5.5.3/jquery.min.js"></script>
	<link href="../webjars/bootstrap/3.3.7-1/css/bootstrap.css" rel="stylesheet">
	<link rel="stylesheet" href="../static/jquery-easyui-1.5.5.3/themes/material-teal/easyui.css" />
	<link rel="stylesheet" href="../static/jquery-easyui-1.5.5.3/themes/icon.css" />
	<script type="text/javascript" src="../static/jquery-easyui-1.5.5.3/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../static/jquery-easyui-1.5.5.3/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="../webjars/bootstrap/3.3.7-1/js/bootstrap.js"></script>
	<script type="text/javascript">
	function dele(id){
		var j=confirm("确定删除此书吗？");
		if(j){
		 $.ajax({ 
		     type: "post", 
		     url: "delete", 
		     data: {id: id}, 
		     success: function (data) { 
		       //  alert("删除成功！"); 
		       window.location.reload();
		    	 //location.replace("/main");
		       } 
		 });
		}else{
			return false;
		}
	}  
</script>
</head>
<body>
	<div  style="margin: 20px;">
	<div class="col-md-7"  style="margin-bottom: 20px; ">
		<form action="../books/searchbtnBook" method="post">
			<input type="hidden" name = "id" id="id">
			<div class="col-md-5" >
				<div class="input-group">
					<span class="input-group-addon">图书名称</span>
					<input type="text" class="form-control" name="title" placeholder="图书名称">
				</div>
			</div>
				<button class="btn btn-success"><span class="glyphicon glyphicon-search"></span> 查询</button>
				<a class="btn btn-danger" th:href="@{/books/bookAll}"><span class="glyphicon glyphicon-trash"></span> 清除查询</a>
				<button type="button" class="btn btn-primary" onclick="window.location.href='edit'"><span class="glyphicon glyphicon-plus"></span> 上传图书</button>
		</form>
		</div>
	</div>
		
	<table style="width: 100%"  class="table table-striped" id="t_book">
		<tr>
			<!-- <td>id</td> -->
			<td>编号</td><td>书名</td><td>图片</td>
			<td>作者</td><td>数量</td><td>操作</td>
		</tr>
		
			<tr th:each="b:${books}">
				<!-- <td th:text="${b.id}"></td> -->
				<td th:text="${b.byid}" style="line-height: 100px;"></td>
				<td th:text="${b.title}" style="line-height: 100px;"> </td>
				<td style="line-height: 100px;">
					<img alt="log" th:src="@{/books/download/(id=${b.id})}" width=80px, height=100px>
				</td>
				<td th:text="${b.suthor}" style="line-height: 100px;"></td>
				<td th:text="${b.number}" style="line-height: 100px;"></td>
				<td>
					<a th:href="@{/books/download(id=${b.id})}"  style="line-height: 100px;">下载</a>
					<a href="#" th:onclick="'javascript:dele(\''+${b.id}+'\')'"  style="line-height: 100px;">删除</a>
				</td>
			</tr>
		
	</table>
</body>
</html>